﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;

namespace WXApi
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var configuration = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory)
                                         .AddJsonFile("appsettings.json").Build();
            string url = configuration["url"];
            CreateWebHostBuilder(args,url).Build().Run();
            //CreateWebHostBuilder(args).Build().Run();
        }


        public static IWebHostBuilder CreateWebHostBuilder(string[] args, string url) =>
            WebHost.CreateDefaultBuilder(args)
                .UseUrls(url)
                .UseStartup<Startup>();

        //public static IWebHostBuilder CreateWebHostBuilder(string[] args)
        //{
        //    var configuration = new ConfigurationBuilder().SetBasePath(Environment.CurrentDirectory)
        //                                  .AddJsonFile("appsettings.json")
        //                                  .Build();

        //    var url = configuration["url"];

        //    return WebHost.CreateDefaultBuilder(args).UseUrls(configuration["url"])
        //                                             .UseStartup<Startup>();
        //}
    }
}
